<template>
  <div class="container">
    <baleTable
      :tableData="tableData"
      :tableHead="tableHead"
      :isSearch="true"
      :tableLoading="tableLoading"
      :page="page"
      @pageSizeChange="pageSizeChange"
      @handleCurrentChange="handleCurrentChange"
      @searchMethods="searchMethods"
      @tableSortChange="tableSortChange"
      @handleRowClick="handleRowClick"
      ref="baleTable"
    >
      <!--    操作 -->
      <template #tableOperation="{ scope }">
        <el-button
          type="danger"
          size="small"
          @click="remove(scope.row)"
          >解除黑名单</el-button
        >
      </template>
    </baleTable>
  </div>
</template>

<script>
import { ApidataStatisticsBlackList } from "@a/index";
import { tableHead } from "./config";
//获取用户列表数据
import tablePrImg from "@/components/tablePrImg.vue";
export default {
  components: {
    tablePrImg,
    /*   userList, */
  },
  data() {
    return {
      tableHead,
      tableData: [
        {
          name: '门诊药房',
          location: '门诊楼一楼',
        }
      ],
      page: {
        page: 1,
        size: 25,
        total: 0,
      },
      tableLoading: false,
      searchParams: {},
      sortParams: {},
      editFormVisible: false,
      btnLoading: false,
    };
  },
  mounted() {
    this.getTableData();
  },
  methods: {
    getTableData(params = {}) {
      let postParams = {
        ...params,
        ...this.searchParams,
        ...this.sortParams,
        ...this.page,
      };
      this.tableLoading = true;
      ApidataStatisticsBlackList(postParams).then((res) => {
        let { data, page } = res;
        // this.tableData = data;
        this.page.total = page.total;
        this.tableLoading = false;
      });
    },
    searchMethods(params) {
      this.searchParams = {};
      this.page.page = 1;
      this.searchParams = params;
      this.getTableData();
    },
    pageSizeChange(val) {
      this.page.size = val;
      this.getTableData();
    },
    handleCurrentChange(val) {
      this.page.page = val;
      this.getTableData();
    },
    tableSortChange(params) {
      if (params.sort_str) {
        this.sortParams = { ...this.sortParams, ...params };
      } else {
        delete this.sortParams.sort_str;
        delete this.sortParams.sort_order;
      }
      this.page.page = 1;
      this.getTableData();
    },
    handleRowClick(params) {},
  },
  filters: {},
};
</script>

<style lang="less" scoped></style>
